package com.thread;

public class DaemonDemo {
	public static void main(String[] args) {
		Thread daemonThread = new Thread(() -> {
			while (true) {
				try {
					System.out.println(" i an alive");
					Thread.sleep(800);
				} catch (InterruptedException e) {
					e.printStackTrace();
				} finally {
					System.out.println("finally block");
				}
			}
		});
		daemonThread.setDaemon(true);
		daemonThread.start();

		try {
			Thread.sleep(800);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}
